package com.hui.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hui.entity.dao.ShopUser;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

import java.math.BigDecimal;

/**
 * 用户表(EshopUser)表数据库访问层
 *
 * @author hui
 * @since 2022-07-11 17:37:54
 */
public interface UserMapper extends BaseMapper<ShopUser> {
    @Update({"update eshop_user set now_money=now_money-#{payPrice} where uid=#{uid}"})
    int decPrice(@Param("payPrice") BigDecimal payPrice, @Param("uid") Long uid);

    @Update({"update eshop_user set pay_count=pay_count+1 where uid=#{uid}"})
    int incPayCount(@Param("uid") Long uid);
}

